.TH CPM 1 "3 May 1983"
.UC 4
.SH NAME
cpm \- read and write CP/M\*R floppy disks
.SH SYNOPSIS
.B cpm 
[ options ] [ filename ]
.SH DESCRIPTION
.PP
.I Cpm
reads and writes files with an internal structure
like a CP/M file system. By default 
.I cpm
assumes that the specified file has the parameters of a standard IBM format
single sided single density 8" CP/M floppy disk, i.e., 2002 records
containing 128 bytes each, of which 52 are reserved for system use and
16 (2 blocks) are used by the directory (maximum 64 directory entries).
These parameters may be changed by
specifying the appropriate flags (see below). Thus, various double
density formats may also be read and written, provided that the hardware
can handle the actual format.
.PP
The specified file may be a floppy disk drive (e.g., /dev/floppy on
an 11/780 or /dev/rrx?b if rx02 drives are available on your system), 
or a standard UNIX\(tm file with the appropriate structure. Since
it may be inconvenient (and slow) to access the device directly, in 
particular the console floppy on an 11/780, it is always a good idea to
copy the contents of the diskette into a standard file using 
\fIdd\fP(1), e.g., 
.sp
.nf
	dd if=/dev/floppy of=yourfile bs=128 count=2002
.fi
.PP
On most systems you have to be superuser to access the console
floppy and to be able to write to rx02's.
.PP
Flags:
.TP 20
.BR \-d
display directory on standard output
.TP
.BR \-B
the files specified with the \fBc\fR or \fBC\fR flag contain binary
code rather than plain text (default)
.TP
\fB\-c \fIname1 name2\fR
copy the CP/M file \fIname1\fR to the UNIX file \fIname2\fR
.TP
\fB\-C \fIname1 name2\fR
copy the UNIX file \fIname1\fR to the CP/M file \fIname2\fR
.TP
\fB\-p \fIname\fR
copy the specified CP/M file to standard output
.TP
.BR \-i
enter interactive mode (all the above flags are turned off)
.TP
.BR \-I
force initializtion of the specified CP/M file (e.g., delete all files)
.TP
.BI \-s n
skew factor (sector interleaving); default is 6
.TP
.BI \-b n
block size (in bytes); default is 1K bytes
.TP
.BI \-m n
max number of directory entries; default is 64
.TP
.BI \-l n
sector size (in bytes); default is 128
.TP
.BI \-r n
number of sectors per track; default is 26
.TP
.BI \-t n
number of tracks; default is 77
.TP
.BI \-R n
number of reserved tracks (i.\& e., for the bootstrap system); default is 2
.PP
If the 
.B \-i
flag is specified, the filename argument must always be present.
If the specified file does not exist, a
new file will be initialized. The 
.B \-C,
.B \-c
and
.B \-p
flags are mutually exclusive.
.PP
The following commands are available in interactive mode:
.TP 24
\fBccopyin \fIunixfile cpmfile\fR
copy UNIX binary file to CP/M
.TP
\fBccopyout \fIcpmfile unixfile\fR
copy CP/M binary file to UNIX
.TP
\fBcopyin \fIunixfile cpmfile\fR
copy UNIX text file to CP/M
.TP
\fBcopyout \fIcpmfile unixfile\fR
copy CP/M text file to UNIX
.TP
\fBdel\fR[ete] \fIfilename\fR
a synonym for \fIerase\fR
.TP
\fBdir\fR[ectory] or \fBls\fP 
display directory 
.TP
\fBera\fR[se] \fIfilename\fR
delete the given file
.TP
\fBhel\fR[p] 
print a short description of each command
.TP
\fBlog\fR[out] or \fBexi\fR[t] 
terminate, return to the shell
.TP
\fBren\fR[ame] \fIfile1 file2\fR
rename \fIfile1\fR to \fIfile2\fR
.TP
\fBtyp\fR[e] \fIfilename\fR
print CP/M file to console; if the environment variable
\fBPAGER\fR exists, it is interpreted as a command to
pipe the output through
.PP
.sp
The commands may be abbreviated as indicated by brackets.
CP/M file names are automatically converted to upper case.
The copy commands refuse to overwrite any existing files.
.PP
If the CP/M floppy file becomes full during a file transfer from UNIX,
the file is closed and the command terminated. 
The data already written to the CP/M file will be saved.
.PP
The
.I copyout 
command assumes that CP/M text files
have cr+lf as line terminators and removes carriage returns.
.I Copyin 
adds a carriage return in front of each line-feed, and adds
a ^Z to the end of the file. The binary copy commands provide
for ``raw'' file copying, thus making it possible to copy code files
to and from diskettes.
.PP
Interrupts are recognized in interactive mode, and will return you to
the command level.
.SH FILES
/dev/floppy
.br
/dev/rrx?b
.br
/usr/new/lib/cpm.hlp 
.SH SEE ALSO
dd(1), rx(4v)
.SH BUGS
CP/M user numbers are ignored, files written
to the CP/M floppy file will always have user number 0.
.PP
CP/M filename extensions containing more than 3 characters will quietly be 
truncated.
.PP
Wildcards are not supported.
.PP
Binary input/output is always handled in multiples of the physical
sector size; CP/M handles it in multiples of 128 byte records.
.SH TRADEMARKS
CP/M is a registered trademark of Digital Research, Inc.
.br
UNIX is a trademark of AT&T Bell Labs.
.SH HISTORY
The original program has been written in 1982 and 1983 by
Helge Skrivervik at the University of California, Berkeley.
It has been adapted by
.if t J\(:org Wunsch
.if n Joerg Wunsch
(joerg_wunsch@uriah.sax.de),
to make it work with double density disks, especially with those having
block numbers > 255. After getting written permission by
Helge Skrivervik to redistribute the program under a Berkeley-style
Copyright, it has been made available with the FreeBSD distribution
in 1994.
.SH AUTHOR
Helge Skrivervik (now [1994] helge@mellvik.no)
